/*
 * Copyright 2005-2013 finalist.cn. All rights reserved.
 * Support: http://www.finalist.cn
 * License: http://www.finalist.cn/license
 */
package com.finalist.template.directive;

import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.regex.Pattern;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.finalist.Filter;
import com.finalist.Order;
import com.finalist.entity.Article;
import com.finalist.entity.Attribute;
import com.finalist.entity.Brand;
import com.finalist.entity.Product;
import com.finalist.entity.ProductCategory;
import com.finalist.entity.Promotion;
import com.finalist.entity.Tag;
import com.finalist.entity.Product.OrderType;
import com.finalist.service.AttributeService;
import com.finalist.service.BrandService;
import com.finalist.service.DepartureService;
import com.finalist.service.DestinationService;
import com.finalist.service.ProductCategoryService;
import com.finalist.service.ProductService;
import com.finalist.service.PromotionService;
import com.finalist.service.TagService;
import com.finalist.util.DateUtil;
import com.finalist.util.FreemarkerUtils;

import freemarker.core.Environment;
import freemarker.template.TemplateDirectiveBody;
import freemarker.template.TemplateException;
import freemarker.template.TemplateModel;

/**
 * 模板指令 - 商品：从哪儿
 * 
 * @author Finalist IT Group
 * @version 3.0
 */
@Component("productDeparturesDirective")
public class ProductDeparturesDirective extends BaseDirective {
	
	@Resource(name = "departureServiceImpl")
	private DepartureService departureService;

	@SuppressWarnings({ "unchecked", "rawtypes" })
	public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException {
		List departures = departureService.findAll();
		setLocalVariable("departures", departures, env, body);
	}

}